package com.morizhang.merchanmanager.api.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.morizhang.merchanmanager.api.ApiResult;
import com.morizhang.merchanmanager.api.IService;
import com.morizhang.merchanmanager.api.plugins.BasicStockManage;
import com.morizhang.merchanmanager.api.plugins.BasicWareManage;

@ServiceAnnotation(name = "DoOneStock")
public class DoOneStockService implements IService {

    private final BasicStockManage basicStockManage;

    public DoOneStockService(BasicStockManage basicStockManage) {
        this.basicStockManage = basicStockManage;
    }

    @Override
    public ApiResult callService(JSONObject requestParams) throws Exception {
        JSONArray stockList = requestParams.getJSONArray("data");
        basicStockManage.doStock(stockList);
        ApiResult result = new ApiResult();
        result.setSuccess(true);
        return result;
    }
}
